//store animations
$(function(){
		
	
	//$stats = $('#statustext').show();
	//$(".content").children().css("display", "none");
	// $(".content").children().fadeIn(1500);
		$(".storecontent").css("display", "none");
		$(".storecontent").fadeIn(1000);	
		$("a.plinks").click(function(event){
			event.preventDefault();
			linkLocation = this.href;
			$(".storecontent").fadeOut(300, redirectPage);		
		});
			
		function redirectPage() {
			window.location = linkLocation;
		}
		
		//popdiv open close
		var $prodS = $('.storeprolist > ul > li'),
		    $prodLi = $('div.storeprolist').children('ul').find('li'),
			$prod1 = $('.storeprolist ul > li:first');
		var $popDiv = $('#catProd');
		var $cclose = $('.cclose');
		
			function closePop(){
				$cclose.click(function(){
						$(this).parent().animate({ top:'480px', height:'0px', opacity:0},200,'easeOutQuad',null);
						$popDiv.children('div').fadeOut(400);
						return false;
				});
					
			}
			//each product click functions
			$prodLi.click(function(){
				//cat product li class name
				//alert($prodLi);
				
				var $proItem =  $(this).attr('class');
				var getV = $proItem;
				var num = getV.replace("a","");
				
				//alert(num);
				$popDiv.stop().animate({ top:'0px', height:'600px', opacity:1},300,'easeOutQuad',null);
				$popDiv.children('div').hide();
				$popDiv.children('div:eq('+num+')').fadeIn(800);
				closePop();
				})	;	
			//on hover cursor adding	
			$prodLi.hover(function(){
				$(this).children().css('cursor','pointer');
				},function(){
				$(this).css('cursor','default');
				})	
			//view cart button action
			var $vCartbtn =$('#viewcartbtn');
			var $vpopDiv = $('#vCart');
		
				$vCartbtn.click(function(){
				//alert("in click");
				
				$vpopDiv.stop().animate({ top:'0px', height:'600px', opacity:1},300,'easeOutQuad',null);
				$vpopDiv.children().fadeIn();
				closePop();
				
				});
				function closePop(){
						$cclose.click(function(){
						$(this).parent().animate({ top:'820px', height:'0px', opacity:0},200,'easeOutQuad',null);
						$vpopDiv.children().fadeOut();
						return false;
					});
					
				}
			//delete from view cart		
			var $vcatpros = $('.itembx').children('ul.slct');
			$vcatpros.children('li.b6').find('img').click(function(){
				
				$(this).parent().parent('ul.slct').fadeOut();
				});
				
			homeicon();
			function homeicon() {
				$(".closeicon").animate({right:'19px',opacity:1},1500,'easeOutElastic',null);
				//$(".storeprolist").niceScroll({cursorborder:"",cursorcolor:"#777777", boxzoom:false});
				}	
			
			$("#ctitles ul").jScrollPane(
					{
						//showArrows:true,
						//maintainPosition: false,
						autoReinitialise: true
					}
					);
			$('#cartJspane').jScrollPane(
					{
						//showArrows:true,
						//maintainPosition: false,
						autoReinitialise: true
					}
					);	
					
			$("[id^='addtocartstore-']").bind('click', function() {

				$('#statustext').fadeIn(1200).show(800).fadeOut(1200);


			}); 			
			//$("body").niceScroll();
});